package nxu.it.service.impl;

import jakarta.inject.Singleton;
import nxu.it.service.GreetingService;

@Singleton
public class GreetingServiceImpl implements GreetingService {
    @Override
    public String sayHello(String name,String gender) {
        if(gender.equals("1"))
        {
            return String.format("你好, %s先生", name);
        } else if (gender.equals("2")) {
            return String.format("你好, %s女士", name);
        }
        else return String.format("你好, %s", name != null ? name : "无名氏");
    }
    public String saybye(String name,String gender){
        if(gender.equals("1"))
        {
            return String.format("再见, %s先生", name);
        } else if (gender.equals("2")) {
            return String.format("再见, %s女士", name);
        }
        else return String.format("再见, %s", name != null ? name : "无名氏");
    }
}
